<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html style='height:100%;'>
<head>
<base href="<%=basePath%>">

<title>隐检审批</title>
<link rel="stylesheet" href="css/vivo.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="js/bootstrap2/css/bootstrap.min.css">
<link rel="stylesheet" href="css/common.css">
<link href="js/select2/select2.min.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="static/p_house/house_index.css" />
<link rel="stylesheet" type="text/css"
	href="js/webuploader-0.1.5/webuploader.css" /> 

<script src="js/jquery-1.11.1.js"></script>
<script src="js/bootstrap2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/layui-v2.1.5/layui/layui.all.js"></script>
<script type="text/javascript"
	src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="js/sharefunction.js"></script>
<script src="js/select2/select2.min.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<!-- 图片放大 -->
<script src="js/postbird-img-glass/postbird-img-glass.js"></script>
<script>
$(function() {
	//禁用按钮
	hideButton();
	getFiles();
	//悬浮提示
	toolTip();
	//修改字段标记记录变量
	<c:set var="marks" value="原数据"/>
});
</script>
</head>
<body>
	<!-- 装修隐检 -->
	<form class="cmxform" id="decorationHideCheck" method="post">
		<input type="hidden" id="hideCheckAdd_articleId">
		<div>
			<div class="panel panel-default">
				<div class="panel-body">
					<table cellpadding="10" cellspacing="5" class="mytable">
						<tr>
							<td width="70" class="td-right">隐检时间</td>
							<td><input name="hideTime" class="Wdate" readonly="readonly" onClick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="<fmt:formatDate value="${requestScope.dh.hideTime }" pattern="yyyy-MM-dd" />"/>
								<c:if test="${not empty requestScope.map.hideTime }"><span class="toolTip mark-msg" data-tip="<fmt:formatDate  value="${requestScope.map.hideTime }" type="both" pattern="yyyy-MM-dd" />">
									<c:out value="${marks}"/></span>
								</c:if>
								<c:if test="${requestScope.map.hideTime=='' }"><span class="toolTip mark-msg"data-tip="空">
									<c:out value="${marks}"/></span>
								</c:if>
							</td>
							<td width="70" class="td-right">隐检项目</td>
							<td><input name="hideName" value="${requestScope.dh.hideName }" />
								<c:if test="${not empty requestScope.map.hideName }"><span class="toolTip mark-msg"data-tip="${requestScope.map.hideName }">
									<c:out value="${marks}"/></span>
								</c:if>
								<c:if test="${requestScope.map.hideName=='' }"><span class="toolTip mark-msg"data-tip="空">
									<c:out value="${marks}"/></span>
								</c:if>
							</td>
						</tr>
						<tr>
							<td width="70" class="td-right">隐检内容</td>
							<td><textarea rows="3" cols="70" style="width:70%"name="hideContent">${requestScope.dh.hideContent }</textarea>
								<c:if test="${not empty requestScope.map.hideContent }"><span class="toolTip mark-msg"data-tip="${requestScope.map.hideContent }">
									<c:out value="${marks}"/></span>
								</c:if>
								<c:if test="${requestScope.map.hideContent=='' }"><span class="toolTip mark-msg"data-tip="空">
									<c:out value="${marks}"/></span>
								</c:if>
							</td>
							<td width="70" id="examine" class="td-right">隐检结论</td>
							<td><textarea rows="3" cols="70" style="width:70%"name="hideVerdict">${requestScope.dh.hideVerdict }</textarea>
								<c:if test="${not empty requestScope.map.hideVerdict }"><span class="toolTip mark-msg"data-tip="${requestScope.map.hideVerdict }">
									<c:out value="${marks}"/></span>
								</c:if>
								<c:if test="${requestScope.map.hideVerdict=='' }"><span class="toolTip mark-msg"data-tip="空">
									<c:out value="${marks}"/></span>
								</c:if>
							</td>
						</tr>
						<tr>
							<td width="70" class="td-right">资料</td>
							<td colspan="3"><input name="hideData" value="${requestScope.dh.hideData }" /> <!-- 附件上传 资料附件。。。-->
								<c:if test="${not empty requestScope.map.hideData }"><span class="toolTip mark-msg"data-tip="${requestScope.map.hideData }">
									<c:out value="${marks}"/></span>
								</c:if>
								<c:if test="${requestScope.map.hideData=='' }"><span class="toolTip mark-msg"data-tip="空">
									<c:out value="${marks}"/></span>
								</c:if>
								<!-- 上传按钮 -->
								<div id='filePicker_yjzl' style="display:none;">上传</div>
								<!-- 缩略图容器 -->
								<div id='list_yjzl'></div></td>
						</tr>
					</table>
				</div>
			</div>
		<input type="hidden" id="entityId_id" name="id" value="${requestScope.dh.id }"/>
		<input type="hidden" id="apId" name="apId" value="${requestScope.apId }"/>
		<c:if test="${requestScope.notPassExamine}">
			<!-- 修改时添加变更说明 -->
			<div style="margin:10px;" id="approvalRemark">
				审批意见<textarea rows="3" name="approvalRemark"style="width:70%"></textarea><span style="color:red;">*</span>
			</div>
			<div style="width:100%;text-align:center; padding-top:0px">
				<button class="btn btn-danger radius my-btn"
					onclick="saveHide(0)" type="button">同意</button>
				<button class="btn btn-default radius"
					onclick="saveHide(1)" type="button">拒绝</button>
			</div>
		</c:if>
		</div>
	</form>

	<script type="text/javascript">
		//展示附件
	  	var acIds ="";//新增附件id集合
		function getFiles() {
		  	//原附件状态为1
		  	getFileListByFlag($("#decorationHideCheck #entityId_id").val(), "隐检资料附件",2, "#list_yjzl",setRFL,imgHidePlus);
		  	<c:if test="${requestScope.notPassExamine}">
			  	var caList = ${requestScope.caList};
			  	//获取序列化操作时的图片数据
				for(var i = 0;i<caList.length;i++){
					acIds += caList[i].accessoryCAId+",";
				} 
				acIds = acIds.substring(0,acIds.length-1);
				getFileListByAcId(acIds,"#list_yjzl",imgHidePlus);
			</c:if>
		}
	  	
		//设置待删除附件的值到集合中
		function setRFL(id, _this) {
			layer.confirm('删除该图片？', {
				title : '警告',
				icon : 0,
				shade : [ 0.1, '#fff' ]
			}, function() {
				//删除指定缩略图
				$("#" + id).remove();
				layer.close(layer.index);
			});
		}
		//图片放大
		function imgHidePlus(data) {
			$.each(data, function(i, v) {
				//图片放大
				PostbirdImgGlass.init({
					domSelector : "#" + v.id + " img",
					animation : true,
					height : '80%',
					myDocument : window.parent.parent.parent
				});
			});
			$("#decorationHideCheck .uploadcancel").css("display", "none");
		}
		
		function hideButton(){
			var hideFlag='${hideFlag}';//查看、编辑状态
			if(hideFlag == "1"){
				//隐藏按钮
				$("#decorationHideCheck").find("input,textarea:not([name=approvalRemark])").attr("readonly", true);
				$("#decorationHideCheck").find(".addbtn,select,input[type='file'],.Wdate").attr("disabled", true);
				//禁止点击上传按钮
				$("#decorationHideCheck div[id^='filePicker_']").css("display", "none");
			}
		}
		
		function saveHide(opt){
			var url = "decorate/hideCheck/disposeHide";
			var apId = '${requestScope.apId }';
			var exDataId = '${exDataId}';
			var approvalRemark = $("textarea[name='approvalRemark']").val();
			var formData = {
					exDataId:exDataId,
		        	opt:opt,
		        	apId:apId,
		        	approvalRemark:approvalRemark
		    };
			disposeSave(opt,url,formData);
		}
	</script>
</body>
</html>
